<!DOCTYPE html>
<html class="no-js" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- bootstrap-css -->
<link rel="stylesheet" href="assets/css/bootstrap.css" th:href="@{css/bootstrap.css}">
<!-- //bootstrap-css -->
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css'  th:href="@{css/style.css}"/>
<!-- font CSS -->
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!-- font-awesome icons -->
<link rel="stylesheet" href="css/font.css" type="text/css" th:href="@{css/font.css}"/>
<link href="css/font-awesome.css" rel="stylesheet" th:href="@{css/font-awesome.css}">
<!-- //font-awesome icons -->
</head>
<body class="signup-body">
		<div class="agile-signup">	
			
			<div class="content2">
				<div class="grids-heading gallery-heading signup-heading">
					<h2>同安智能智慧实验室</h2>
				</div>
				<form th:action="@{/login}" th:method="post" th:id="loginform " onsubmit="return check(this)">

					<input type="text" th:id="username" th:name="username" th:placeholder="请输入用户名"
						   onfocus="this.value = '';">
					<input type="password" th:id="password" th:name="password" th:placeholder="请输入密码"
						   onfocus="this.value = '';">
					<div class="signin-text">
						<div class="text-left">
							<p>
								<span style="color: red; " th:if="${ not #strings.isEmpty(msg)} " th:utext="${msg}"></span>
								<span style="color: red; " id="msg"></span>
							</p>
						</div>
					</div>
					<input type="submit" class="register" th:value="登录"></input>
				</form>
				<div class="signin-text">
					<div class="text-left">
						<p><a href="#"> 忘记密码? </a></p>
					</div>
					<div class="text-right">
						<p><a href="signup.html" th:href="@{/signup}"> 注册新用户</a></p>
					</div>
					<div class="clearfix"> </div>
				</div>

			</div>
			
			<!-- footer -->

			<!-- //footer -->
			
		</div>

		<script th:src="@{js/md5.js}"></script>
			<script>
				function check(form) {
					document.getElementById("msg").innerText = "";
					if(form.username.value=='') {
						document.getElementById("msg").innerText = "请输入用户帐号!";
						form.username.focus();
						return false;
					}
					else if(form.password.value==''){
						document.getElementById("msg").innerText = "请输入登录密码!";
						form.password.focus();
						return false;
					}
					else if (!document.getElementById("username").value == "" && !document.getElementById("password").value == "") {
						var username = document.getElementById("username").value;
						var pass = document.getElementById("password").value;
						var salt = "123456";
						var permit = hex_md5(username + pass + salt);
						document.getElementById("password").value = permit;
						return true;
					}
					else
					{
						return  false;
					}

				}
			</script>
	
</body>
</html>
